package com.slz3.business.module.messageManagement.mesTemplate.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.messageManagement.mesTemplate.domain.MesTemplate;
import com.slz3.business.module.messageManagement.mesTemplate.domain.MesTemplateFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MesTemplateTransactionalServiceImpl implements MesTemplateTransactionalService {

    @Override
    public MesTemplate modify(MesTemplate mesTemplateNew) {
        Repositorys.mesTemplate.test();
        Repositorys.mesTemplate.save(MesTemplateFactory.initBaseFields());
        System.err.println(1 / 0);
        mesTemplateNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.mesTemplate.saveAndFlush(mesTemplateNew);
    }

    @Override
    public List<MesTemplate> batchModify(List<MesTemplate> mesTemplateList) {
        return Repositorys.mesTemplate.saveAll(mesTemplateList);
    }
}
